using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.Serialization;
using System.Web.Script.Serialization;
using System.Xml.Serialization;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;

namespace WpfBill.Data
{
    /// <summary>工程信息</summary>
    [Serializable]
    [DataObject]
    [Description("工程信息")]
    [BindTable("tb_project", Description = "工程信息", ConnName = "MyConn", DbType = DatabaseType.None)]
    public partial class Project : IProject
    {
        #region 属性
        private Int32 _ID;
        /// <summary></summary>
        [DisplayName("ID")]
        [DataObjectField(true, true, false, 0)]
        [BindColumn("ID", "", "int(11)")]
        public Int32 ID { get => _ID; set { if (OnPropertyChanging("ID", value)) { _ID = value; OnPropertyChanged("ID"); } } }

        private String _Name;
        /// <summary>单位名称</summary>
        [DisplayName("项目名称")]
        [Description("项目名称")]
        [DataObjectField(false, false, true, 50)]
        [BindColumn("Name", "项目名称", "varchar(100)", Master = true)]
        public String Name { get => _Name; set { if (OnPropertyChanging("Name", value)) { _Name = value; OnPropertyChanged("Name"); } } }

        private String _EnterpriseA;
        /// <summary>甲方单位</summary>
        [DisplayName("甲方单位")]
        [Description("甲方单位")]
        [DataObjectField(false, false, false, 50)]
        [BindColumn("EnterpriseA", "甲方单位", "varchar(100)")]
        public String EnterpriseA { get => _EnterpriseA; set { if (OnPropertyChanging("EnterpriseA", value)) { _EnterpriseA = value; OnPropertyChanged("EnterpriseA"); } } }

        private String _EnterpriseB;
        /// <summary>乙方单位</summary>
        [DisplayName("乙方单位")]
        [Description("乙方单位")]
        [DataObjectField(false, false, false, 50)]
        [BindColumn("EnterpriseB", "乙方单位", "varchar(100)")]
        public String EnterpriseB { get => _EnterpriseB; set { if (OnPropertyChanging("EnterpriseB", value)) { _EnterpriseB = value; OnPropertyChanged("EnterpriseB"); } } }

        private String _PersonA;
        /// <summary>甲方负责人</summary>
        [DisplayName("甲方负责人")]
        [Description("甲方负责人")]
        [DataObjectField(false, false, true, 50)]
        [BindColumn("PersonA", "甲方负责人", "varchar(50)")]
        public String PersonA { get => _PersonA; set { if (OnPropertyChanging("PersonA", value)) { _PersonA = value; OnPropertyChanged("PersonA"); } } }

        private String _AccountA;
        /// <summary>甲方账户</summary>
        [DisplayName("甲方账户")]
        [Description("甲方账户")]
        [DataObjectField(false, false, true, 50)]
        [BindColumn("AccountA", "甲方账户", "varchar(50)")]
        public String AccountA { get => _AccountA; set { if (OnPropertyChanging("AccountA", value)) { _AccountA = value; OnPropertyChanged("AccountA"); } } }

        private String _PhoneA;
        /// <summary>甲方电话</summary>
        [DisplayName("甲方电话")]
        [Description("甲方电话")]
        [DataObjectField(false, false, true, 50)]
        [BindColumn("PhoneA", "甲方电话", "varchar(50)")]
        public String PhoneA { get => _PhoneA; set { if (OnPropertyChanging("PhoneA", value)) { _PhoneA = value; OnPropertyChanged("PhoneA"); } } }

        private String _PersonB;
        /// <summary>乙方负责人</summary>
        [DisplayName("乙方负责人")]
        [Description("乙方负责人")]
        [DataObjectField(false, false, true, 50)]
        [BindColumn("PersonB", "乙方负责人", "varchar(50)")]
        public String PersonB { get => _PersonB; set { if (OnPropertyChanging("PersonB", value)) { _PersonB = value; OnPropertyChanged("PersonB"); } } }

        private String _AccountB;
        /// <summary>乙方账户</summary>
        [DisplayName("乙方账户")]
        [Description("乙方账户")]
        [DataObjectField(false, false, true, 50)]
        [BindColumn("AccountB", "乙方账户", "varchar(50)")]
        public String AccountB { get => _AccountB; set { if (OnPropertyChanging("AccountB", value)) { _AccountB = value; OnPropertyChanged("AccountB"); } } }

        private String _PhoneB;
        /// <summary>乙方电话</summary>
        [DisplayName("乙方电话")]
        [Description("乙方电话")]
        [DataObjectField(false, false, true, 50)]
        [BindColumn("PhoneB", "乙方电话", "varchar(50)")]
        public String PhoneB { get => _PhoneB; set { if (OnPropertyChanging("PhoneB", value)) { _PhoneB = value; OnPropertyChanged("PhoneB"); } } }

        private Decimal _Balance;
        /// <summary>余额</summary>
        [DisplayName("余额")]
        [Description("余额")]
        [DataObjectField(false, false, false, 0)]
        [BindColumn("Balance", "余额", "decimal")]
        public Decimal Balance { get => _Balance; set { if (OnPropertyChanging("Balance", value)) { _Balance = value; OnPropertyChanged("Balance"); } } }

        private String _CreateUser;
        /// <summary>创建者</summary>
        [DisplayName("创建者")]
        [Description("创建者")]
        [DataObjectField(false, false, true, 50)]
        [BindColumn("CREATE_USER", "创建者", "")]
        public String CreateUser { get => _CreateUser; set { if (OnPropertyChanging("CreateUser", value)) { _CreateUser = value; OnPropertyChanged("CreateUser"); } } }

        private Int32 _CreateUserID;
        /// <summary>创建用户</summary>
        [DisplayName("创建用户")]
        [Description("创建用户")]
        [DataObjectField(false, false, false, 0)]
        [BindColumn("CREATE_USERID", "创建用户", "")]
        public Int32 CreateUserID { get => _CreateUserID; set { if (OnPropertyChanging("CreateUserID", value)) { _CreateUserID = value; OnPropertyChanged("CreateUserID"); } } }

        private DateTime _CreateTime;
        /// <summary>创建时间</summary>
        [DisplayName("创建时间")]
        [Description("创建时间")]
        [DataObjectField(false, false, false, 0)]
        [BindColumn("CREATE_TIME", "创建时间", "")]
        public DateTime CreateTime { get => _CreateTime; set { if (OnPropertyChanging("CreateTime", value)) { _CreateTime = value; OnPropertyChanged("CreateTime"); } } }

        private String _UpdateUser;
        /// <summary>更新者</summary>
        [DisplayName("更新者")]
        [Description("更新者")]
        [DataObjectField(false, false, true, 50)]
        [BindColumn("UPDATE_USER", "更新者", "")]
        public String UpdateUser { get => _UpdateUser; set { if (OnPropertyChanging("UpdateUser", value)) { _UpdateUser = value; OnPropertyChanged("UpdateUser"); } } }

        private Int32 _UpdateUserID;
        /// <summary>更新用户</summary>
        [DisplayName("更新用户")]
        [Description("更新用户")]
        [DataObjectField(false, false, false, 0)]
        [BindColumn("UPDATE_USERID", "更新用户", "")]
        public Int32 UpdateUserID { get => _UpdateUserID; set { if (OnPropertyChanging("UpdateUserID", value)) { _UpdateUserID = value; OnPropertyChanged("UpdateUserID"); } } }

        private DateTime _UpdateTime;
        /// <summary>更新时间</summary>
        [DisplayName("更新时间")]
        [Description("更新时间")]
        [DataObjectField(false, false, false, 0)]
        [BindColumn("UPDATE_TIME", "更新时间", "")]
        public DateTime UpdateTime { get => _UpdateTime; set { if (OnPropertyChanging("UpdateTime", value)) { _UpdateTime = value; OnPropertyChanged("UpdateTime"); } } }
        #endregion

        #region 获取/设置 字段值
        /// <summary>获取/设置 字段值</summary>
        /// <param name="name">字段名</param>
        /// <returns></returns>
        public override Object this[String name]
        {
            get
            {
                switch (name)
                {
                    case "ID": return _ID;
                    case "Name": return _Name;
                    case "EnterpriseA": return _EnterpriseA;
                    case "EnterpriseB": return _EnterpriseB;
                    case "PersonA": return _PersonA;
                    case "AccountA": return _AccountA;
                    case "PhoneA": return _PhoneA;
                    case "PersonB": return _PersonB;
                    case "AccountB": return _AccountB;
                    case "PhoneB": return _PhoneB;
                    case "Balance": return _Balance;
                    case "CreateUser": return _CreateUser;
                    case "CreateUserID": return _CreateUserID;
                    case "CreateTime": return _CreateTime;
                    case "UpdateUser": return _UpdateUser;
                    case "UpdateUserID": return _UpdateUserID;
                    case "UpdateTime": return _UpdateTime;
                    default: return base[name];
                }
            }
            set
            {
                switch (name)
                {
                    case "ID": _ID = value.ToInt(); break;
                    case "Name": _Name = Convert.ToString(value); break;
                    case "EnterpriseA": _EnterpriseA = Convert.ToString(value); break;
                    case "EnterpriseB": _EnterpriseB = Convert.ToString(value); break;
                    case "PersonA": _PersonA = Convert.ToString(value); break;
                    case "AccountA": _AccountA = Convert.ToString(value); break;
                    case "PhoneA": _PhoneA = Convert.ToString(value); break;
                    case "PersonB": _PersonB = Convert.ToString(value); break;
                    case "AccountB": _AccountB = Convert.ToString(value); break;
                    case "PhoneB": _PhoneB = Convert.ToString(value); break;
                    case "Balance": _Balance = Convert.ToDecimal(value); break;
                    case "CreateUser": _CreateUser = Convert.ToString(value); break;
                    case "CreateUserID": _CreateUserID = value.ToInt(); break;
                    case "CreateTime": _CreateTime = value.ToDateTime(); break;
                    case "UpdateUser": _UpdateUser = Convert.ToString(value); break;
                    case "UpdateUserID": _UpdateUserID = value.ToInt(); break;
                    case "UpdateTime": _UpdateTime = value.ToDateTime(); break;
                    default: base[name] = value; break;
                }
            }
        }
        #endregion

        #region 字段名
        /// <summary>取得工程信息字段信息的快捷方式</summary>
        public partial class _
        {
            /// <summary></summary>
            public static readonly Field ID = FindByName("ID");

            /// <summary>单位名称</summary>
            public static readonly Field Name = FindByName("Name");
            /// <summary>单位ID</summary>
            public static readonly Field EnterpriseA = FindByName("EnterpriseA");

            /// <summary>乙方单位ID</summary>
            public static readonly Field EnterpriseB = FindByName("EnterpriseB");

            /// <summary>甲方负责人</summary>
            public static readonly Field PersonA = FindByName("PersonA");

            /// <summary>甲方账户</summary>
            public static readonly Field AccountA = FindByName("AccountA");

            /// <summary>甲方电话</summary>
            public static readonly Field PhoneA = FindByName("PhoneA");

            /// <summary>乙方负责人</summary>
            public static readonly Field PersonB = FindByName("PersonB");

            /// <summary>乙方账户</summary>
            public static readonly Field AccountB = FindByName("AccountB");

            /// <summary>乙方电话</summary>
            public static readonly Field PhoneB = FindByName("PhoneB");

            /// <summary>余额</summary>
            public static readonly Field Balance = FindByName("Balance");

            /// <summary>创建者</summary>
            public static readonly Field CreateUser = FindByName("CreateUser");

            /// <summary>创建用户</summary>
            public static readonly Field CreateUserID = FindByName("CreateUserID");

            /// <summary>创建时间</summary>
            public static readonly Field CreateTime = FindByName("CreateTime");

            /// <summary>更新者</summary>
            public static readonly Field UpdateUser = FindByName("UpdateUser");

            /// <summary>更新用户</summary>
            public static readonly Field UpdateUserID = FindByName("UpdateUserID");

            /// <summary>更新时间</summary>
            public static readonly Field UpdateTime = FindByName("UpdateTime");

            static Field FindByName(String name) => Meta.Table.FindByName(name);
        }

        /// <summary>取得工程信息字段名称的快捷方式</summary>
        public partial class __
        {
            /// <summary></summary>
            public const String ID = "ID";

            /// <summary>项目名称</summary>
            public const String Name = "Name";
            /// <summary>单位ID</summary>
            public const String EnterpriseA = "EnterpriseA";

            /// <summary>乙方单位ID</summary>
            public const String EnterpriseB = "EnterpriseB";

            /// <summary>甲方负责人</summary>
            public const String PersonA = "PersonA";

            /// <summary>甲方账户</summary>
            public const String AccountA = "AccountA";

            /// <summary>甲方电话</summary>
            public const String PhoneA = "PhoneA";

            /// <summary>乙方负责人</summary>
            public const String PersonB = "PersonB";

            /// <summary>乙方账户</summary>
            public const String AccountB = "AccountB";

            /// <summary>乙方电话</summary>
            public const String PhoneB = "PhoneB";

            /// <summary>余额</summary>
            public const String Balance = "Balance";

            /// <summary>创建者</summary>
            public const String CreateUser = "CreateUser";

            /// <summary>创建用户</summary>
            public const String CreateUserID = "CreateUserID";

            /// <summary>创建时间</summary>
            public const String CreateTime = "CreateTime";

            /// <summary>更新者</summary>
            public const String UpdateUser = "UpdateUser";

            /// <summary>更新用户</summary>
            public const String UpdateUserID = "UpdateUserID";

            /// <summary>更新时间</summary>
            public const String UpdateTime = "UpdateTime";
        }
        #endregion
    }

    /// <summary>工程信息接口</summary>
    public partial interface IProject
    {
        #region 属性
        /// <summary></summary>
        Int32 ID { get; set; }
        /// <summary>
        /// 项目名称
        /// </summary>
        String Name { get; set; }
        /// <summary>单位ID</summary>
        String EnterpriseA { get; set; }

        /// <summary>乙方单位ID</summary>
        String EnterpriseB { get; set; }

        /// <summary>甲方负责人</summary>
        String PersonA { get; set; }

        /// <summary>甲方账户</summary>
        String AccountA { get; set; }

        /// <summary>甲方电话</summary>
        String PhoneA { get; set; }

        /// <summary>乙方负责人</summary>
        String PersonB { get; set; }

        /// <summary>乙方账户</summary>
        String AccountB { get; set; }

        /// <summary>乙方电话</summary>
        String PhoneB { get; set; }

        /// <summary>余额</summary>
        Decimal Balance { get; set; }

        /// <summary>创建者</summary>
        String CreateUser { get; set; }

        /// <summary>创建用户</summary>
        Int32 CreateUserID { get; set; }

        /// <summary>创建时间</summary>
        DateTime CreateTime { get; set; }

        /// <summary>更新者</summary>
        String UpdateUser { get; set; }

        /// <summary>更新用户</summary>
        Int32 UpdateUserID { get; set; }

        /// <summary>更新时间</summary>
        DateTime UpdateTime { get; set; }
        #endregion

        #region 获取/设置 字段值
        /// <summary>获取/设置 字段值</summary>
        /// <param name="name">字段名</param>
        /// <returns></returns>
        Object this[String name] { get; set; }
        #endregion
    }
}